<template>
  <div id="mydiv">
    <p>无敌爆爆龙 {{ parentMessage }}</p>
    <input type="text" v-model="localMessage" @input="sendToParent" />
  </div>
</template>//v-model="localMessage"localMessage实时更新为输入框中的内容

<script>
export default {
  props: {
    parentMessage: {
      type: String,
      required: true
    }
  },
  data() {
    return {
      localMessage: ''
    };
  },
  methods: {
    sendToParent() {
      this.$emit('child-event', this.localMessage);
    }
  }
};
</script>

<style>
    #mydiv {
        
        border: 1px solid black;
        background-color: aqua;
    }
</style>
